//
//  SecViewController.m
//  06_UINavigationController
//
//  Created by dllo on 16/7/21.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "SecViewController.h"

@interface SecViewController ()

@end

@implementation SecViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor grayColor];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(20, 100, 60, 30);
    [button setTitle:@"难受啊" forState:UIControlStateNormal];
    [self.view addSubview:button];
    
    button.backgroundColor = [UIColor cyanColor];
    [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)click:(UIButton *)button {
    // 返回上一级视图控制器
    [self.navigationController popToRootViewControllerAnimated:YES];
    // 返回跟视图控制器
//    [self.navigationController popToRootViewControllerAnimated:YES];
    // 返回指定的视图控制器
//    self.navigationController popToViewController:<#(nonnull UIViewController *)#> animated:<#(BOOL)#>
    NSLog(@"%@", self.navigationController.viewControllers);

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
